package String;

public class StartOrEnd {

	public static void main(String[] args) {
		// 判断字符串是否以特定字符串开头或结尾
		String num1 = "22045612";
		String num2 = "21304578";
		boolean b = num1.startsWith("22");
		boolean b1 = num1.endsWith("78");
		boolean b2 = num2.startsWith("22");
		boolean b3 = num2.endsWith("78");
		System.out.println("字符串num1是以'22'开始的吗?"+b);
		System.out.println("字符串num1是以'78'结束的吗?"+b1);
		System.out.println("字符串num1是以'22'开始的吗?"+b2);
		System.out.println("字符串num1是以'78'结束的吗?"+b3);

	}

}
